import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

import 'package:get/get.dart';

import '../controllers/text_controller.dart';

class TextView extends GetView<TextController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Text案例'),
        centerTitle: true,
      ),
      body: Container(
        padding: EdgeInsets.all(10),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              "text test 文字很长文字很长文字很长文字很长文字很长文字很长文字很长文字很长文字很长文字很长文字很长文字很长",
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
            ),
            Container(
              width: double.infinity,
              child: Text(
                "文字靠右",
                textAlign: TextAlign.right,
              ),
            ),
            Text(
              "加粗倾斜20字体",
              style: TextStyle(
                  fontWeight: FontWeight.bold,
                  fontStyle: FontStyle.italic,
                  fontSize: 20),
            ),
            Text(
              "2倍行高\n2被行高",
              style: TextStyle(height: 2),
            ),
            Text.rich(
              TextSpan(text: "rich", children: [
                TextSpan(
                  text: "Text",
                  style: TextStyle(color: Colors.red, fontSize: 18),
                ),
              ]),
            ),
          ],
        ),
      ),
    );
  }
}
